package de.syfy.project.engine.testpackage;

import de.syfy.project.engine.Animation;
import de.syfy.project.engine.Texture;
import de.syfy.project.engine.errors.NoSuchAnimationException;
import de.syfy.project.game.CharacterModel;
import de.syfy.project.game.GamePanel;
import de.syfy.project.game.Player;
import java.awt.geom.Point2D;
import java.io.IOException;
import javax.swing.JFrame;

/**
 *
 * @author Timo
 * 
 * Zum testen der Engine.
 * 
 * Ist eigentlich überflüssig! ;)
 */
public class TestKlasse{
    
    public static void main(String args[]){
        new TestKlasse();
    }
    
    JFrame frame;
    GamePanel panel;
    
    public TestKlasse(){
        GamePanel gp = new GamePanel();
        CharTest ct = new CharTest(gp);
        Player pl = new Player(gp);
        Texture[] tex = new Texture[4];
        CharacterModel up = new CharacterModel(gp);
        Texture[] stand_s = new Texture[2];
        up.setPosition(new Point2D.Float(100, 100));
        up.getCharacter().getCharValue().setHp(1000);
       
        try {
            tex[0] = gp.getTextureLoader().getTexture("animationTest/0.png");
            tex[1] = gp.getTextureLoader().getTexture("animationTest/1.png");
            tex[2] = gp.getTextureLoader().getTexture("animationTest/2.png");
            tex[3] = tex[0];
            stand_s[0]= gp.getTextureLoader().getTexture("animationTest/Character test/LinkGB_stand_front.gif");
            stand_s[1]= stand_s[0];
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        Animation ani1 = new Animation();
        ani1.loadTextures(tex);
        Animation ani_stand_s = new Animation();
        ct.registerAnimation("ani", ani1);
        ani_stand_s.loadTextures(stand_s);
        up.registerAnimation("stand_sued", ani_stand_s);
        ct.setPosition(new Point2D.Float(0,0));
        pl.setPosition(new Point2D.Float(0,0));
        try {
            ct.playAnimation("ani");
            up.playAnimation("stand_sued");
        } catch (NoSuchAnimationException ex) {
            ex.printStackTrace();
        }
        //gp.getActualWorld().addSprite(ct);
        gp.getActualWorld().addSprite(pl);
        gp.getActualWorld().addSprite(up);
        gp.start();
        
    }

}